package com.deli.springboot.quartz.sendMessage;

import org.quartz.*;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SendMessageJob implements Job {
    private String message;

    public void setMessage(String message) {
        this.message = message;
    }


    public void execute(JobExecutionContext context) throws JobExecutionException {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("当前时间为" + format.format(date));
//        JobKey key = context.getJobDetail().getKey();
//        System.out.println("获取detail参数的值" + key.getName() + "   " + key.getGroup());
//        TriggerKey key1 = context.getTrigger().getKey();
//        System.out.println("获取trigger参数的值" + key1.getName() + "   " + key1.getGroup());
//        JobDataMap jobDataMap1 = context.getJobDetail().getJobDataMap();
//        JobDataMap mergedJobDataMap = context.getMergedJobDataMap();//如果键值相同，优先取trigger的键的值

        //String message = jobDataMap1.getString("message");
//        System.out.println("自定义map的值是" + message);
//        Trigger currentTrigger=context.getTrigger();
//        System.out.println("Start time是："+currentTrigger.getStartTime());
//        System.out.println("End time是："+currentTrigger.getEndTime());
    }
}
